package com.dykj.fireFighting.server.socialUnit.devicemanger.mapper;

import com.dykj.fireFighting.api.base.video.entity.Video;
import com.dykj.fireFighting.api.socialUnit.devHis.entity.CrtPointVo;
import com.dykj.fireFighting.api.socialUnit.devHis.entity.CrtVo;
import com.dykj.fireFighting.api.socialUnit.devicemanger.entity.Device;
import com.dykj.fireFighting.api.socialUnit.devicemanger.entity.DeviceTree;
import com.dykj.fireFighting.api.socialUnit.devicemanger.vo.DeviceElectricalVo;
import com.dykj.fireFighting.api.socialUnit.devicemanger.vo.DeviceWaterVo;
import com.dykj.fireFighting.common.core.mapper.SuperMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @Description 设备管理-智能设备
 * @Author JacksonTu
 * @Date  2021-06-22 15:55:39
 */
public interface DeviceMapper extends SuperMapper<Device> {
    String getTableName(String relationId);

    /**
     * 获取火灾自动报警设备当前状态
     * @param relationId
     * @return
     */
    String getFireDevStatus(String relationId);

    /**
     * 获取水设备当前状态
     * @param relationId
     * @return
     */
    String getWaterDevStatus(String relationId);

    /**
     * 获取电气火灾报警设备状态
     * @param relationId
     * @return
     */
    String getElectricalDevStatus(String relationId);
    /**
     * 水设备详情
     * @param relationId
     * @return
     */
    DeviceWaterVo getDeviceWaterDetails(String relationId);
    Device bigDataDevice(String id);
    /**
     * 电气设备详情
     *
     * @param relationId
     * @return
     */
    DeviceElectricalVo getDeviceElectricalDetails(String relationId);

    int importDevice(List<Device> list);

    int deleteDeviceByMaufactorIdentification(String maufactorIdentification);

    /**
     * 下拉列表
     * @param unitId
     * @return
     */
    @Select("<script>" +
            "select * from device where is_del = 0 and unit_id =#{unitId} " +
            "<if test='deviceName!=null'>"+
            "and name like '%${deviceName}%'" +
            "</if>"+
            "</script>")
    List<Device> getList(@Param("unitId")String unitId,@Param("deviceName")String deviceName);


    /**
     * @param devHisId
     * @return
     */
    Device getByDevHisId(String devHisId);

    /**
     * 获取智能设备树形数据
     * @param unitId
     * @return
     */
    List<DeviceTree> getDeviceTree(String unitId);
    /**
     * 获取传统设备树形数据
     * @param unitId
     * @return
     */
    List<DeviceTree> getTraditionDeviceTree(String unitId);
    /**
     * 获取救援设备树形数据
     * @param unitId
     * @return
     */
    List<DeviceTree> getRescueDeviceTree(String unitId);
    /**
     * 获取监控设备树形数据
     * @param unitId
     * @return
     */
    List<DeviceTree> getVideoDeviceTree(String unitId);
    /**
     * 获取监控设备树形数据
     * @param unitId
     * @return
     */
    List<DeviceTree> getEscapeRouteTree(String unitId);
    Video getVideoByDeviceId(String deviceId);
    CrtVo getCrt(String deviceId);
    List<CrtPointVo> getCrtPoint(String partItionId);

    int getNumByUnitId(@Param("unitId") String unitId);
    Device getDeviceByRelationId(String relationId);
    String getIconByDeviceId(String deviceId);
    String getEscapeRouteIcon( String deviceId);

    List<DeviceTree> getStationDeviceTree(@Param("unitId") String unitId);

    List<DeviceTree> getPartDeviceTree(@Param("unitId") String unitId);

    List<DeviceTree> getSourcesDeviceTree(@Param("unitId") String unitId);
}
